<script>
	export default {
		globalData: {
			statusBarHeight: 20,
			windowWidth: 375,
			navBarWidth: 375,
			navBarHeight: 45,			
			windowHeight: 0,//总高度
			userInfo:null,
			serviceType:[
				{
					id :'1',
					name:'专家'
				},
				{
					id :'2',
					name:'课程'
				},
				{
					id :'3',
					name:'农产品'
				},
				{
					id :'4',
					name:'农户求助'
				},
				{
					id :'5',
					name:'农事服务'
				},
				{
					id :'6',
					name:'信贷'
				},
				{
					id :'7',
					name:'补贴'
				},
				{
					id :'8',
					name:'新闻'
				},
			],
			requestTasks: {}
		},
		onLaunch: function() {
			console.warn('当前组件仅支持 uni_modules 目录结构 ，请升级 HBuilderX 到 3.1.0 版本以上！')
			console.log('App Launch')
			this.getHeight()
			//uni.hideTabBar()
			uni.onTabBarMidButtonTap(() => {
				console.log('test点击',this.$refs.tabpopup)
				// this.$refs.tabpopup.open('bottom')
				uni.navigateTo({
					url:"/pages/tabbar/tabbar-3/tabbar-3"
				})
			})
			//this.isLogin()
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			getHeight() {
				//获取手机系统信息
				const info = uni.getSystemInfoSync();
				//设置状态栏高度
				
				this.globalData.statusBarHeight = info.statusBarHeight;
				this.globalData.windowWidth = info.windowWidth;
				this.globalData.windowHeight = info.windowHeight;
				// h5 app mp-alipay没有胶囊按钮
				// #ifndef H5 || APP-PLUS || MP-ALIPAY
				// 获取胶囊的位置
				const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
				// (胶囊底部高度 - 状态栏的高度) + (胶囊顶部高度 - 状态栏内的高度) = 导航栏的高度
				console.log("systeminfo", info,menuButtonInfo)
				this.globalData.navBarHeight = (menuButtonInfo.bottom - info.statusBarHeight) + (menuButtonInfo.top - info
					.statusBarHeight)
				this.globalData.navBarWidth = menuButtonInfo.left
				// #endif
			},
			/* isLogin(){
				if(!uni.getStorageSync('X-Token')){
					uni.navigateTo({
						url: '/pages/login/login'
					})
					return
				}
			} */
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import '@/uni_modules/uni-scss/index.scss';
	/* uni.css - 通用组件、模板样式库，可以当作一套ui库应用 */
	@import './common/uni.css';
	/* 自定义样式 */
	@import '@/common/style.scss';
	/* #ifndef APP-NVUE */
	@import '@/static/customicons.css';

	/* #endif */
	// 设置整个项目的背景色
	page {
		background-color: #f5f5f5;
		height: 100%;
	}

	//设置tabbar样式
	.uni-tabbar {
		background-image: url('https://staticfile-yj.obs.myhuaweicloud.com/tabbar-bg.png') !important;
		background-repeat: no-repeat !important;
		background-size: 100% 100% !important;
		background-position: top center !important;
		padding-top: 10px;
	}

	.example-info {
		font-size: 14px;
		color: #333;
		padding: 10px;
	}
</style>